package com.sikaryofficial.ai.config;

/**
 * @author : wuweihong
 * @desc : TODO  请填写你的功能描述
 * @date : 2025-11-04
 */


import org.springframework.ai.chat.client.ChatClient;
import org.springframework.ai.chat.client.advisor.MessageChatMemoryAdvisor;
import org.springframework.ai.chat.memory.ChatMemory;
import org.springframework.ai.tool.ToolCallbackProvider;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

@Configuration
public class ChatClientConfig {
	@Bean
	public ChatClient chatClient(ChatClient.Builder builder, ToolCallbackProvider tool, ChatMemory chatMemory) {
		return builder
				// 将所有 MCP 工具作为默认工具回调注册到 ChatClient
				.defaultToolCallbacks(tool)
				.defaultAdvisors(MessageChatMemoryAdvisor.builder(chatMemory).build())
				.build();
	}


}
